from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

driver_path = r"D:\chromedriver\chromedriver.exe"
req_url = 'https://www.baidu.com'
driver = webdriver.Chrome(executable_path=driver_path)
driver.get(req_url)

inputTag = driver.find_element_by_id('kw')
submitBtn = driver.find_element_by_id('su')

actions = ActionChains(driver)
actions.move_to_element(inputTag)
actions.send_keys_to_element(inputTag, 'python')
actions.move_to_element(submitBtn)
actions.click(submitBtn)
# click_and_hold 点击不松开
# context_click() 右键点击
# double_click() 双击
actions.perform()